UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eRn0dZBskprktP6B6UqTpCJtv4+a6ORDBBlDpUPEnag=' 
WHERE 
  key_id = 'f88ed13bb2c6e3366f6776ac8cb4fef16d02e14808ff01430ea3451c118d812f' 
  AND (
    token = 'eRn0dZBskprktP6B6UqTpCJtv4+a6ORDBBlDpUPEnag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00085