UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Qft3JNF5yJG9tbxNRnFg0YbmaBYeuS07bl6IOh5Krs=' 
WHERE 
  key_id = '566c94d117505ec2d7a9effc4e7de5e2fc621c0c71c2e82c072d2ceff0304ee1' 
  AND (
    token = '0Qft3JNF5yJG9tbxNRnFg0YbmaBYeuS07bl6IOh5Krs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00085