UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SRn7k+YxdFTh/GqAUIu62JgIFKQ3+eYy1Mhlb6Uaj4Y=' 
WHERE 
  key_id = 'f965fbb3df25394790c70a9c15c12de87620ae7d9d35dbf8a07f2b5d42718025' 
  AND (
    token = 'SRn7k+YxdFTh/GqAUIu62JgIFKQ3+eYy1Mhlb6Uaj4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030