UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1NXeIKMouirGNMnk+u0BEn2I87mm+ISjeTNVFjvanVc=' 
WHERE 
  key_id = '8f239fca58c470c2f9e2149eff42ae0832a2d5272f8eb7dc337542e3269540d5' 
  AND (
    token = '1NXeIKMouirGNMnk+u0BEn2I87mm+ISjeTNVFjvanVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030