UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Phz9s3rWz4KCoF3YF+F335FB9kauYP2kzG6cLTlcQRs=' 
WHERE 
  key_id = 'd4a347b2858996906cd28a62620b5ba10ec2ebf8dd91d2c0180d9994ef5123fd' 
  AND (
    token = 'Phz9s3rWz4KCoF3YF+F335FB9kauYP2kzG6cLTlcQRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038