UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'esj9jJWOSIP0DhZxwzLDP8q8EvbxUd9sX1YYIPAe7II=' 
WHERE 
  key_id = '9ddf7d2273544fc8aac6ca2ce577279ade8e57dfe89796970a11ca57e92da7b2' 
  AND (
    token = 'esj9jJWOSIP0DhZxwzLDP8q8EvbxUd9sX1YYIPAe7II=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016