UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EKEWAQ0r9171frsXxJyl+OnDfHrnblV9hkwJkxmYE54=' 
WHERE 
  key_id = '61417b343817a7822195eb46dcf305ad1d5a1034da2ed55ea8195ea9cb4f9c65' 
  AND (
    token = 'EKEWAQ0r9171frsXxJyl+OnDfHrnblV9hkwJkxmYE54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043