UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IlnueFRrCwILH1g3EUzcCxXSnela01st4gBYJmH0y7w=' 
WHERE 
  key_id = 'b644b01e5b72184fc3a19fc4f1c1d47f362399200cf487523b1e4d7041be0dcf' 
  AND (
    token = 'IlnueFRrCwILH1g3EUzcCxXSnela01st4gBYJmH0y7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048