UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gja4EgN5e96b3YdCrDMb0BhxRUmHDwulI89yIg72IWI=' 
WHERE 
  key_id = '9c96744b9ddc4952e3b77e6f162f870145dcfdaf772bfe34951f20affd64b49e' 
  AND (
    token = 'Gja4EgN5e96b3YdCrDMb0BhxRUmHDwulI89yIg72IWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043