UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MqYJBwUWbDBOazo2SdD+rYadjGJq8R11X81MPM6KSs8=' 
WHERE 
  key_id = 'c13c3dcf777955b4db82c43f65324963318c209d148b13fd5812d17734679bb9' 
  AND (
    token = 'MqYJBwUWbDBOazo2SdD+rYadjGJq8R11X81MPM6KSs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037