UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EnC8tF8P/2JfG5EGe90AruRT7acwk9LW9KHAQu7duu0=' 
WHERE 
  key_id = '4ae25d976b35e07afc4eb4082a5d4de603c044248d2785e01431dcfd6baea323' 
  AND (
    token = 'EnC8tF8P/2JfG5EGe90AruRT7acwk9LW9KHAQu7duu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032