UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MEm10NIdYfJzjhV95OKhHKTXLOHSR6lYPdJmuq02Xps=' 
WHERE 
  key_id = '16db9daf00d7b74109c68bbdbf099c6edced7e60057603323e92820602a4fb0c' 
  AND (
    token = 'MEm10NIdYfJzjhV95OKhHKTXLOHSR6lYPdJmuq02Xps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030