UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vZhfKlpMLRK6tIj/aJtGtY9oc8z6Xwx+azAMia87f5g=' 
WHERE 
  key_id = '3bdf1361bbc053f8237274dc67bea08a9360be177499292860b1bc0f7e1b384a' 
  AND (
    token = 'vZhfKlpMLRK6tIj/aJtGtY9oc8z6Xwx+azAMia87f5g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036