UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jn1fSdSvYOwK12cSXJMSFqBVU8DY7OJ8aoguwuVtmKo=' 
WHERE 
  key_id = '2f37b861da5b4c5cfebdaa78056e145396bac41f790595d7a9a1476d9c1daa93' 
  AND (
    token = 'jn1fSdSvYOwK12cSXJMSFqBVU8DY7OJ8aoguwuVtmKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035