UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'clB+f3J2ewrXjMa6jXzKFAVmlLjd4MQvT5pfSceM6Nw=' 
WHERE 
  key_id = 'a25def7c701a2bf8b1abde250cf7d7f5fab8ecc159c7c3c147063cd9d9029bb6' 
  AND (
    token = 'clB+f3J2ewrXjMa6jXzKFAVmlLjd4MQvT5pfSceM6Nw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038