UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hZIpsF5Bpf1mSKKEj22EcG1psvJXMwZveRAaFmvxGYk=' 
WHERE 
  key_id = '9707964ef5eec7b0ef298cde39e8f9242e449f0087a426a45cd84901314b68c5' 
  AND (
    token = 'hZIpsF5Bpf1mSKKEj22EcG1psvJXMwZveRAaFmvxGYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018