UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jB7lmDD5OuIIPtnUb3AK123POcUN+suabKk2xBcz/pk=' 
WHERE 
  key_id = 'a15c2c99318da38769b6e81f924fe8fd4a510de71175572866fa581146bb5d92' 
  AND (
    token = 'jB7lmDD5OuIIPtnUb3AK123POcUN+suabKk2xBcz/pk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026