UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hN2h0Q+ESfs9sPkmqb2CBz+UItGsJ4v78MBdi5CiCH0=' 
WHERE 
  key_id = '2f0f6cd6ca0834f4bc99f11a048d32c6d339c5c337b3e4d1cc41036dd527ca12' 
  AND (
    token = 'hN2h0Q+ESfs9sPkmqb2CBz+UItGsJ4v78MBdi5CiCH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028