UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C7dCCzD9nq27mPYhvpLODQELoVapk5pqEFKqkm/VWIs=' 
WHERE 
  key_id = '0de98a88488839a0937a8696b6aa197d1364b110600653588253391acbfd1e33' 
  AND (
    token = 'C7dCCzD9nq27mPYhvpLODQELoVapk5pqEFKqkm/VWIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022