UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0EHeZq6SuXg0C1POnYRek0u6Oxy4H4tCc8Pglw7Nz0E=' 
WHERE 
  key_id = '7007e67b7259b832c95123e42582acc66793781894496f433758829918f96930' 
  AND (
    token = '0EHeZq6SuXg0C1POnYRek0u6Oxy4H4tCc8Pglw7Nz0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032