UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAhx3RyFQE5B34CYEVXm9d9tc2gAtSGByckxYYbh8R0=' 
WHERE 
  key_id = '3a776388f96d76859675012004fbbe829d92bf0fa80e9c9382c4515a2c906541' 
  AND (
    token = 'dAhx3RyFQE5B34CYEVXm9d9tc2gAtSGByckxYYbh8R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049