UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p5f+FAmdYFMRwNvbAF6AIqnK70xMEAUi4oRtqXlMPYU=' 
WHERE 
  key_id = 'b28046322e236e715aee187730b51f2e3c2277327b20726470f727bf9a4b440d' 
  AND (
    token = 'p5f+FAmdYFMRwNvbAF6AIqnK70xMEAUi4oRtqXlMPYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054