UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GzCjktuKXQ+WxTyy9o2hcSBBpq9t/HoEnAEXrzxJ0nM=' 
WHERE 
  key_id = '21621c39548c82f47756fa16f289980f9e0b1d0c9e5101a847efc37b2f4d83dc' 
  AND (
    token = 'GzCjktuKXQ+WxTyy9o2hcSBBpq9t/HoEnAEXrzxJ0nM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024