UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fsTL6bXTPbOOFRY5rFXvAkdbOctRWBkeBiYG+5nDRak=' 
WHERE 
  key_id = 'bde520c9c4aa75e0f3c88f56caca8b8c3a1ad4b6e0fc059174f640e62c0d716d' 
  AND (
    token = 'fsTL6bXTPbOOFRY5rFXvAkdbOctRWBkeBiYG+5nDRak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048