UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aHj3b7uKxRNkQvuauFm3YwTvbKXt7342er+1euc6I4Y=' 
WHERE 
  key_id = 'f3a5c11f76126d90bca7c9a9e22a16cc75936f2b89ff958a56ee4feae528e2e3' 
  AND (
    token = 'aHj3b7uKxRNkQvuauFm3YwTvbKXt7342er+1euc6I4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052