UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6M235Hdf78V5RvNOz64mTv+dVLvdsLmjgjEZSYXCgqI=' 
WHERE 
  key_id = 'e7d19901215d88804cd7a694b126afffb5039fedcf483fb3528e6ee397c4c20b' 
  AND (
    token = '6M235Hdf78V5RvNOz64mTv+dVLvdsLmjgjEZSYXCgqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064