UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IfJkkiraxUkahBnAzptXon5zcC4qckkysnDg0pOaloY=' 
WHERE 
  key_id = '01e575539c324e0bca212fa474e9e37c0a204618913e492c52042a4e3462ab0b' 
  AND (
    token = 'IfJkkiraxUkahBnAzptXon5zcC4qckkysnDg0pOaloY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036