UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mYIh0+MuC1AhVWqhhq6AveUsyINOLxp42PshNzwb9bM=' 
WHERE 
  key_id = '5a7d9d9aa8e768b9be864b0d64e96c84e7a5d12a373ae71103025a35d438f7f7' 
  AND (
    token = 'mYIh0+MuC1AhVWqhhq6AveUsyINOLxp42PshNzwb9bM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040