UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DHEn21SvbteWnSHQVt9uq5jcOYVz4Yob/UOy9Pcyi9M=' 
WHERE 
  key_id = '23f27b7b14e5a96a88f6c90bc1cd238ed6113d025c1653a9cc16d813e2ce94b0' 
  AND (
    token = 'DHEn21SvbteWnSHQVt9uq5jcOYVz4Yob/UOy9Pcyi9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046