UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9VarwlZNNNp89TEsM/TSh8MeGETI0rdmaKsC+W71Xdw=' 
WHERE 
  key_id = '1d3fc3395a7147c8aff563f0a77bc3e1dc40b9abfe5cdbd21169ed919b6aa136' 
  AND (
    token = '9VarwlZNNNp89TEsM/TSh8MeGETI0rdmaKsC+W71Xdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032