UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'si51w82cNfneOE6fJSWSnPGTkRw+uIJ6gkf8iLWfhUg=' 
WHERE 
  key_id = '32e2e9e55100dd687a4c49fec6f1610b405fb4f7f8eaf03d9b18dc50ee789160' 
  AND (
    token = 'si51w82cNfneOE6fJSWSnPGTkRw+uIJ6gkf8iLWfhUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030