UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'isfUkSA+knKGUefE0V/WubbCIw0ZkqZ/JQLpGs2p5WQ=' 
WHERE 
  key_id = 'ef6044cc6d2d83950e5c49725d30d33c1c3d999753d6523401b9ce682726c303' 
  AND (
    token = 'isfUkSA+knKGUefE0V/WubbCIw0ZkqZ/JQLpGs2p5WQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029